home *** CD-ROM | disk | FTP | other *** search
- /* creatnew.c --- p 489 */
- #include <stdio.h>
- #include <dos.h>
- #include <io.h>
- extern unsigned char _osmajor;
- main()
- {
- int handle;
- char filename[60];
- if(_osmajor <3)
- {
- printf("'creatnew' needs DOS version 3.0 or higher\n");
- exit(0);
- }
- printf("Enter name of file to be created: ");
- gets(filename);
- /* Call 'creatnew' to create the file. Mode 0 means
- * a normal file. */
- if((handle = creatnew(filename, 0)) == -1)
- perror("Error in creatnew");
- else
- printf("File %s created\n", filename);
- }